package org.example.commonapi.mongo;

import org.example.commonapi.domain.onlineCode.CodeTopic;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

public interface CodeTopicRepository extends MongoRepository<CodeTopic, String> {
    Page<CodeTopic> findByIsBanAndIsCreated(Integer isBan, Boolean isCreated, Pageable pageable);

    @Query("{'isBan': ?0, 'isCreated': ?1, 'title': {$regex: ?2, $options: 'i'}}")
    Page<CodeTopic> findByIsBanAndIsCreatedAndTitleContaining(Integer isBan, Boolean isCreated, String title, Pageable pageable);

}
